package cn.bird.storm.sysauth.controller;

import cn.bird.storm.sysauth.model.dto.SysUserDTO;
import cn.bird.storm.component.jackson.response.ResponseResult;
import cn.bird.storm.component.log.WebLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;

@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    @PostMapping("/test")
    @WebLog("测试 post")
    public ResponseResult<SysUserDTO> test(@RequestBody SysUserDTO dto) {
        log.info("GlobalExceptionHandler---TestController.test,dto:{}",dto);
        System.out.println(dto.getUserType().getCode());
        dto.setDate(LocalDate.now());
        return ResponseResult.success(dto);
    }

    @GetMapping("/get")
    @WebLog("测试 GET")
    public ResponseResult<SysUserDTO> get(SysUserDTO dto) {
        log.info("GlobalExceptionHandler---TestController.test,dto:{}", dto);
        System.out.println(dto.getUserType().getCode());
        dto.setDate(LocalDate.now());
        return ResponseResult.success(dto);
    }

}
